<template>
  <k-view class="empty-view flex-center" :style="{ width, height }">
    <k-view class="loading" v-if="loading"></k-view>
    <k-view v-else>
      <k-text class="empty-view-text">{{ msg }}</k-text>
    </k-view>
  </k-view>
</template>

<script>
export default {
  props: {
    msg: {
      type: String,
      default: '暂无更多内容',
    },
    width: {
      type: [String, Number],
      default: '100%',
    },
    height: {
      type: [String, Number],
      default: '100%',
    },
    imgUrl: {
      type: String,
    },
    loading: Boolean,
  },
};
</script>
<style lang="less" scoped>
.empty-view {
  background: transparent;
  &-text {
    color: rgba(0, 0, 0, 0.6);
    [theme-mode='black'] & {
      color: rgba(255, 255, 255, 0.6);
    }
  }
}
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading {
  width: 32px;
  height: 32px;
  margin-right: 12px;
  background-image: url('@/assets/loading.png');
  background-size: cover;
  [theme-mode='black'] & {
    background-image: url('@/assets/loading_dark.png');
  }
  animation: rotate 1s linear infinite;
}
@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}
</style>
